CFLAGS = -Wall -std=c99
LDFLAGS = -lm -L/usr/lib/arm-linux-gnueabihf -lcurl -lbcm2835

main: bin/main.o bin/duvoice.o bin/cJSON.o bin/base64.o bin/weather.o
	gcc $(CFLAGS) $^ -o $@ $(LDFLAGS)

bin/main.o: main.c duvoice/duvoice.h
	gcc -c $(CFLAGS) $< -o $@

bin/duvoice.o: duvoice/duvoice.c cjson/cJSON.h base64/base64.h duvoice/duvoice.h
	gcc -c $(CFLAGS) $< -o $@

bin/cJSON.o: cjson/cJSON.c cjson/cJSON.h
	gcc -c $(CFLAGS) $< -o $@

bin/base64.o: base64/base64.c base64/base64.h
	gcc -c $(CFLAGS) $< -o $@

bin/weather.o: weather/weather.c
	gcc -c $(CFLAGS) $< -o $@

clean:
	@-rm -v bin/*.o
	@-rm -v main
